<?php

class FormElement_Select extends AbstractSelectionElement
{

  public $showEmpty = true;

  public $emptyValue = '';

  public $emptyLabel = '';

  public function render(IDictionary $row, $action)
  {
    switch ($action) {
      case Form::ACTION_EDIT :
      case Form::ACTION_CREATE :
        $view = $this->getView($action);

        $view->set('value', $this->getValue($row));
        $view->set('class', $this->getClass($row, $action));
        $view->set('options', $this->getOptions());
        $view->set('showEmpty', $this->showEmpty);
        $view->set('emptyValue', $this->emptyValue);
        $view->set('emptyLabel', $this->emptyLabel);

        return $view->render();

        break;
    }

    return parent::render($row, $action);
  }

  public function getDisplayValue(&$row)
  {
    return sy_get_param($this->getOptions(), $this->getValue($row));
  }

}

?>